package com.mybook.app.feign;

import com.mybook.app.response.MinaAccessTokenResponse;
import feign.Param;
import feign.RequestLine;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 微信小程序接口
 *
 * @author hjq
 */
@FeignClient(url = "${mybook.wx.url}", name = "mina")
public interface MinaFeignClient {

    /**
     * 向微信服务器获取openid，unionid，session_key
     *
     * @param
     */
    //@RequestLine("GET /sns/jscode2session?appid={APPID}&secret={SECRET}&js_code={JSCODE}&grant_type=authorization_code")
    @RequestMapping(method = RequestMethod.GET, value = "/sns/jscode2session", produces = "application/json; charset=UTF-8",
            consumes = "application/json; charset=UTF-8")
    public String jscode2session(@RequestParam("appid") String appid,
                                                  @RequestParam("secret") String secret,
                                                  @RequestParam("js_code") String jsCode,
                                                  @RequestParam("grant_type") String grantType);


}
